﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microhard.WarehouseInsp.Buz.Interfaces;
using Microhard.WarehouseInsp.Buz.DataAccess;
using Microhard.WarehouseInsp.Buz.DTO;

namespace Microhard.WarehouseInsp.Buz.Impls
{
    public class ApproveRecordImpl : IApproveRecord
    {
        public Core.DBUtility.ExecutedResult Add(Models.ApproveRecordModel model)
        {
            throw new NotImplementedException();
        }

        public Core.DBUtility.ExecutedResult Update(Models.ApproveRecordModel model)
        {
            throw new NotImplementedException();
        }

        public Core.DBUtility.ExecutedResult Delete(List<Guid> ids)
        {
            throw new NotImplementedException();
        }

        public Core.DBUtility.ExecutedResult Delete(Models.ApproveRecordModel model)
        {
            throw new NotImplementedException();
        }

        public Models.ApproveRecordModel GetModelByID(Guid id)
        {
            throw new NotImplementedException();
        }

        public Models.ApproveRecordModel GetModelByModel(Models.ApproveRecordModel model)
        {
            throw new NotImplementedException();
        }

        public List<Models.ApproveRecordModel> Query(Models.ApproveRecordModel Model, int pageIndex, int pageSize, out int totalCount)
        {
            throw new NotImplementedException();
        }

        public List<Models.ApproveRecordModel> Query(Models.ApproveRecordModel Model)
        {
            WarehouseInspEntities db = new WarehouseInspEntities();
            return (from a in db.ApproveRecords
                    where a.PKID == Model.PKID
                    select a).OrderByDescending(o => o.ApproveEndTime).ToList().Select(t => t.ToModel()).ToList();
        }

        public Core.DBUtility.ScopeResult scope
        {
            set;
            get;
        }
    }
}
